﻿//-------------------------------------------------------------------------------------------------
// <copyright file="SKillHandlers.cs" company="Anthony Adam">
// Copyright (c) Anthony Adam 2012. All rights reserved.
// </copyright>
//-------------------------------------------------------------------------------------------------
// ReSharper disable once CheckNamespace
namespace SuperStarRounds
{
  using System.Windows.Forms;

  using Models;
  /// <summary>
  /// Utility class containing the skill choice control population functions.
  /// </summary>
  public static class SkillHandlers
  {
    /// <summary>
    /// Sets the current content selected in the application using the check marks
    /// on the select content check boxes tab.
    /// </summary>
    /// <param name="settings">Content Configuration settings</param>
    /// <param name="comboBox">The choice control to be populated</param>
    public static void SetSkillList(ContentInclusions settings, ComboBox comboBox)
    {
      comboBox.Items.Clear();

      // TODO: include other books skills

      AddSkill(settings.IncludeCoreRules, comboBox, "Acrobatics");
      AddSkill(settings.IncludeCoreRules, comboBox, "Appraise");
      AddSkill(settings.IncludeCoreRules, comboBox, "Bluff");
      AddSkill(settings.IncludeCoreRules, comboBox, "Climb");
      AddSkill(settings.IncludeCoreRules, comboBox, "Craft");
      AddSkill(settings.IncludeCoreRules, comboBox, "Diplomacy");
      AddSkill(settings.IncludeCoreRules, comboBox, "Disable Device");
      AddSkill(settings.IncludeCoreRules, comboBox, "Disguise");
      AddSkill(settings.IncludeCoreRules, comboBox, "Escape Artist");
      AddSkill(settings.IncludeCoreRules, comboBox, "Fly");
      AddSkill(settings.IncludeCoreRules, comboBox, "Handle Animal");
      AddSkill(settings.IncludeCoreRules, comboBox, "Heal");
      AddSkill(settings.IncludeCoreRules, comboBox, "Intimidate");
      AddSkill(settings.IncludeCoreRules, comboBox, "Knowledge");
      AddSkill(settings.IncludeCoreRules, comboBox, "Linguistics");
      AddSkill(settings.IncludeCoreRules, comboBox, "Perception");
      AddSkill(settings.IncludeCoreRules, comboBox, "Perform");
      AddSkill(settings.IncludeCoreRules, comboBox, "Profession");
      AddSkill(settings.IncludeCoreRules, comboBox, "Ride");
      AddSkill(settings.IncludeCoreRules, comboBox, "Sense Motive");
      AddSkill(settings.IncludeCoreRules, comboBox, "Sleight of Hand");
      AddSkill(settings.IncludeCoreRules, comboBox, "Spellcraft");
      AddSkill(settings.IncludeCoreRules, comboBox, "Stealth");
      AddSkill(settings.IncludeCoreRules, comboBox, "Survival");
      AddSkill(settings.IncludeCoreRules, comboBox, "Swim");
      AddSkill(settings.IncludeCoreRules, comboBox, "Use Magic Device");

      if (comboBox.Items.Count > 0)
        comboBox.SelectedIndex = 0;
      else
        comboBox.Text = string.Empty;
    }

    private static void AddSkill(bool addIt, ComboBox comboBox, string skill)
    {
      if (!addIt) return;

      comboBox.Items.Add(skill);
    }

    /// <summary>
    /// Populates the skill sub school choices.
    /// </summary>
    /// <param name="settings">Content Configuration settings</param>
    /// <param name="skill">The skill who's subskills are required</param>
    /// <param name="comboBox">The choice control to be populated</param>
    public static void SetSubSkillList(ContentInclusions settings, string skill, ComboBox comboBox)
    {
      comboBox.Items.Clear();
      switch (skill)
      {
        case "Craft":
          AddSkill(settings.IncludeCoreRules, comboBox, "alchemy");
          AddSkill(settings.IncludeCoreRules, comboBox, "armor");
          AddSkill(settings.IncludeCoreRules, comboBox, "baskets");
          AddSkill(settings.IncludeCoreRules, comboBox, "books");
          AddSkill(settings.IncludeCoreRules, comboBox, "bows");
          AddSkill(settings.IncludeCoreRules, comboBox, "calligraphy");
          AddSkill(settings.IncludeCoreRules, comboBox, "carpentry");
          AddSkill(settings.IncludeCoreRules, comboBox, "cloth");
          AddSkill(settings.IncludeCoreRules, comboBox, "clothing");
          AddSkill(settings.IncludeCoreRules, comboBox, "glass");
          AddSkill(settings.IncludeCoreRules, comboBox, "jewelry");
          AddSkill(settings.IncludeCoreRules, comboBox, "leather");
          AddSkill(settings.IncludeCoreRules, comboBox, "locks");
          AddSkill(settings.IncludeCoreRules, comboBox, "paintings");
          AddSkill(settings.IncludeCoreRules, comboBox, "pottery");
          AddSkill(settings.IncludeCoreRules, comboBox, "sculptures");
          AddSkill(settings.IncludeCoreRules, comboBox, "ships");
          AddSkill(settings.IncludeCoreRules, comboBox, "shoes");
          AddSkill(settings.IncludeCoreRules, comboBox, "stonemasonry");
          AddSkill(settings.IncludeCoreRules, comboBox, "traps");
          AddSkill(settings.IncludeCoreRules, comboBox, "weapons");
          break;

        case "Knowledge":
          AddSkill(settings.IncludeCoreRules, comboBox, "arcana");
          AddSkill(settings.IncludeCoreRules, comboBox, "dungeoneering");
          AddSkill(settings.IncludeCoreRules, comboBox, "engineering");
          AddSkill(settings.IncludeCoreRules, comboBox, "geography");
          AddSkill(settings.IncludeCoreRules, comboBox, "history");
          AddSkill(settings.IncludeCoreRules, comboBox, "local");
          AddSkill(settings.IncludeCoreRules, comboBox, "nature");
          AddSkill(settings.IncludeCoreRules, comboBox, "nobility");
          AddSkill(settings.IncludeCoreRules, comboBox, "planes");
          AddSkill(settings.IncludeCoreRules, comboBox, "religion");
          break;

        case "Perform":
          AddSkill(settings.IncludeCoreRules, comboBox, "act");
          AddSkill(settings.IncludeCoreRules, comboBox, "comedy");
          AddSkill(settings.IncludeCoreRules, comboBox, "dance");
          AddSkill(settings.IncludeCoreRules, comboBox, "keyboard instruments");
          AddSkill(settings.IncludeCoreRules, comboBox, "oratory");
          AddSkill(settings.IncludeCoreRules, comboBox, "percussion instruments");
          AddSkill(settings.IncludeCoreRules, comboBox, "sing");
          AddSkill(settings.IncludeCoreRules, comboBox, "string instruments");
          AddSkill(settings.IncludeCoreRules, comboBox, "wind insstruments");
          break;

        case "Profession":
          AddSkill(settings.IncludeCoreRules, comboBox, "architect");
          AddSkill(settings.IncludeCoreRules, comboBox, "baker");
          AddSkill(settings.IncludeCoreRules, comboBox, "barrister");
          AddSkill(settings.IncludeCoreRules, comboBox, "brewer");
          AddSkill(settings.IncludeCoreRules, comboBox, "butcher");
          AddSkill(settings.IncludeCoreRules, comboBox, "clerk");
          AddSkill(settings.IncludeCoreRules, comboBox, "cook");
          AddSkill(settings.IncludeCoreRules, comboBox, "courtesan");
          AddSkill(settings.IncludeCoreRules, comboBox, "driver");
          AddSkill(settings.IncludeCoreRules, comboBox, "engineer");
          AddSkill(settings.IncludeCoreRules, comboBox, "farmer");
          AddSkill(settings.IncludeCoreRules, comboBox, "fisherman");
          AddSkill(settings.IncludeCoreRules, comboBox, "gambler");
          AddSkill(settings.IncludeCoreRules, comboBox, "gardener");
          AddSkill(settings.IncludeCoreRules, comboBox, "herbalist");
          AddSkill(settings.IncludeCoreRules, comboBox, "innkeeper");
          AddSkill(settings.IncludeCoreRules, comboBox, "librarian");
          AddSkill(settings.IncludeCoreRules, comboBox, "merchant");
          AddSkill(settings.IncludeCoreRules, comboBox, "midwife");
          AddSkill(settings.IncludeCoreRules, comboBox, "miller");
          AddSkill(settings.IncludeCoreRules, comboBox, "miner");
          AddSkill(settings.IncludeCoreRules, comboBox, "porter");
          AddSkill(settings.IncludeCoreRules, comboBox, "sailor");
          AddSkill(settings.IncludeCoreRules, comboBox, "scribe");
          AddSkill(settings.IncludeCoreRules, comboBox, "shepherd");
          AddSkill(settings.IncludeCoreRules, comboBox, "stable master");
          AddSkill(settings.IncludeCoreRules, comboBox, "soldier");
          AddSkill(settings.IncludeCoreRules, comboBox, "tanner");
          AddSkill(settings.IncludeCoreRules, comboBox, "trapper");
          AddSkill(settings.IncludeCoreRules, comboBox, "woodcutter");
          break;
      }

      if (comboBox.Items.Count > 0)
        comboBox.SelectedIndex = 0;
      else
        comboBox.Text = string.Empty;
    }
  }
}